These samples demonstrate using XNamespace in LINQ to XML to work with XML Namespaces.

[Category("XName")]
[Description("Find xsd:element with name=FullAddress")]
public void XLinq87()
{
XDocument doc = XDocument.Load("nw_customers.xsd");
XNamespace XSD = "http://www.w3.org/2001/XMLSchema";
XElement result = doc.Descendants(XSD + "element")
.Where(e => (string)e.Attribute("name") == "FullAddress")
.First();
Console.WriteLine(result);
}
[Category("XName")] [Description("Find xsd:element with name=FullAddress")] public void XLinq87() { XDocument doc = XDocument.Load("nw_customers.xsd"); XNamespace XSD = "http://www.w3.org/2001/XMLSchema"; XElement result = doc.Descendants(XSD + "element") .Where(e => (string)e.Attribute("name") == "FullAddress") .First(); Console.WriteLine(result); }
For more information on LINQ to XML: http://msdn.microsoft.com/en-us/library/bb387098.aspx